<script lang="ts" setup>
import { ref } from "vue";
import { uploadPath, handleFileChange } from "./useUpload";

const emit = defineEmits<{
  ok: any;
}>();

const fileList = ref<any[]>([]);

const handleChange = (info: any) => {
  handleFileChange(info, (...rest: []) => {
    // console.log(rest);
    emit("ok", ...rest);
  });
};
</script>

<template>
  <a-upload
    v-model:file-list="fileList"
    name="file"
    :show-upload-list="false"
    :action="uploadPath"
    @change="handleChange"
  >
    <ProButton type="primary" text="导入" icon="fileAddOutlined" />
  </a-upload>
</template>

<style lang="less" scoped></style>
